pp108 : sendAndWait Method

sendAndWait Method


This method sends an XML document to the backend, waits for the response and handles the response when it is received.

Syntax

busdataislandID.sendAndWait(xmlDocument)

Parameters

Parameter

Description

xmlDocument

Required. Object that contains the XML Document of the SOAP message that is to be sent to the back end. The SOAP message can be an update (insert, update or delete) request or fresh data request.


Return Value


No return values.

Remarks


This method puts the data received from the backend to the data property of the busdataisland. This method can be used for explicit request of data from the backend. In case of a read request, the automatic property can be set to 'false'.

Example


The following example shows how to send a request to the using sendAndWait method.

<!-- Busdataisland definition -->
<div cordysType="wcp.libaray.data.BusDataIsland  id="Products" automatic="false" async="false" request="constructor.XMLDocument" onresponse="showData()"></div>
<!-- XML document request -->
<script type="cordys/XML" id="constructor">
    <SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
        <SOAP:Body>
            <GetProducts xmlns="http://schemas.cordys.com/1.0/demo/northwind">
                <fromProductID>1</fromProductID>
                <toProductID>10</toProductID>
            </GetProducts>
        </SOAP:Body>
    </SOAP:Envelope>
</script>
//Function for sending the request
function sendRequest()
{
    var requestDoc = ProductsQuery.XMLDocument;
    Products.sendAndWait(requestDoc);
}
//Function called on onresponse of the request
function showData()
{
    application.notify(cordys.getXML(window.application.event.response.XMLDocument));
}

See Also


busdataisland